package cn.wind.xboot.framework.web.controller;

import cn.wind.xboot.logic.pf.service.IPfNoticeService;
import cn.wind.xboot.logic.sys.service.*;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dozer.DozerBeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.context.request.WebRequest;

import java.io.Serializable;

/**
 * <p>Title: BaseController</p>
 * <p>Description: TODO</p>
 *
 * @author xukk
 * @version 1.0
 * @date 2018/6/22
 */
public abstract class BaseController<E, ID extends Serializable> implements Base {
    @Autowired
    protected DozerBeanMapper beanMapper;
    @Autowired
    protected StringRedisTemplate redisTemplate;
    @Autowired
    protected ISysRoleService sysRoleService;
    @Autowired
    protected ISysPermissionService sysPermissionService;
    @Autowired
    protected ISysUserService sysUserService;
    @Autowired
    protected ISysUserRoleService sysUserRoleService;
    @Autowired
    protected ISysUserInfoService sysUserInfoService;
    @Autowired
    protected ISysPrivilegeService sysPrivilegeService;
    @Autowired
    protected IPfNoticeService pfNoticeService;
    @Autowired
    protected ISysDictTypeService sysDictTypeService;
    @Autowired
    protected ISysDictDataService sysDictDataService;
    @Autowired
    protected ISysLogService sysLogService;

    @Override
    public IService getService() {
        return null;
    }

    @InitBinder
    public void initBinder(WebDataBinder webDataBinder, WebRequest webRequest) {
        webDataBinder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    }
}
